package com;

public class BinaryToDecimalILoveYou {
       public static void main(String[] args) {
    	   
              toChar("01001001");
              System.out.println();
              toChar("01001100");
              toChar("01001111");
              toChar("01010110");
              toChar("01000101");
              System.out.println();
              toChar("01011001");
              toChar("01001111");
              toChar("01010101");
       }
       
       private static char toChar(String s) {
              int c = 0;
              if(!s.equals("")) {
                     String s1 = s.trim();
                     Integer[] a = new Integer[s1.length()];
                     for(int i = 0; i < s1.length(); i++) {
                           a[i] = Integer.parseInt(s1.substring(i,i+1));
                     }
                     
                     for(int j = 0; j < a.length; j++) {
                           c = (int)(c + a[j]*Math.pow(2, a.length-j-1));
                     }
                    System.out.print((char)c);
              }
              
              
              
              return (char)c;
       }
}

